#include "string.h"
#include "stdlib.h"
#include "stdio.h"

typedef void (*execute_t)(void);

typedef struct TCommandTab
{
    execute_t execute;
}TCommand;

typedef struct TInvokeTab
{
    TCommand* command;
}TInvoke;

void doing_something(void)
{
    printf("hello world\n");
};

void doing_something_2(void)
{
    printf("goodbye\n");
}

void add_Command(TInvoke* invoke,TCommand* command)
{
    invoke->command = command;
}

void main()
{
    TInvoke* invoke = (TInvoke*)malloc(sizeof(TInvoke));
    TCommand* command = (TCommand*)malloc(sizeof(TCommand));
    add_Command(invoke,command);
    command->execute = doing_something;
    invoke->command->execute();
    command->execute = doing_something_2;
    invoke->command->execute();

    free(invoke);
    free(command);
}
